package mall

import (
	"fmt"
	"github.com/gin-gonic/gin"
	v1 "newbeemallStudyProject/api/vi"
	"newbeemallStudyProject/middleware"
)

type MallUserRouter struct{}

func (m *MallUserRouter) InitMallUserRouter(router *gin.RouterGroup) {
	fmt.Println("进入到router层====")
	userRouter := router.Group("v1").Use(middleware.UserJWTAuth())
	userRouterNotWithToken := router.Group("v1")
	fmt.Println(userRouter)
	mallUserApi := v1.ApiGroupApp.MallApiGroup.MallUserApi
	{
		userRouter.GET("user/test", mallUserApi.GetTest)
		//查询用户数据
		userRouter.GET("user/info", mallUserApi.GetUserInfo)
		//登出
		userRouter.POST("user/userLayout", mallUserApi.UserLayout)
		//修改用户信息
		userRouter.POST("user/userInfoUpdate", mallUserApi.UserInfoUpdate)
	}
	{
		//用户注册
		userRouterNotWithToken.POST("user/register", mallUserApi.UserRegister)
		//用户登录
		userRouterNotWithToken.POST("user/userLogin", mallUserApi.UserLogin)
	}

}
